﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;

namespace Protobuf_Gui.Domain
{
    [Serializable]
    [ContainType(typeof(PbEnumValue),"Value")]
    public class PbEnum : ProtocolElement
    {
        public PbEnum(string name) : base(name)
        {
            Values = new List<PbEnumValue>();
        }

        public List<PbEnumValue> Values { get; set; }

        public override TreeNode ToTreeNode(TreeNode root)
        {
            throw new NotImplementedException();
        }

        public override void ToFile(TextWriter writer, uint nesting)
        {
            string tabs = Tabs(nesting);
            writer.WriteLine("{0}enum {1}", tabs, Name);
            writer.Write("{0}", tabs);
            writer.WriteLine("{");
            foreach (var value in Values)
            {
                value.ToFile(writer, nesting + 1);
            }
            writer.Write("{0}", tabs);
            writer.WriteLine("}");
        }
    }
}